#include<bits/stdc++.h>
using namespace std;
const int N=5e5+10;
int a[N],n,vis[N],T; 
int main(){
	scanf("%d",&T);
	while(T--){
		int ans=0;
		scanf("%d",&n);
		for(int i=1;i<=n;i++) scanf("%d",&a[i]),vis[i]=0;
		vis[n+1]=0;
		for(int i=1;i<=n;i++){
			vis[a[i]]=1;
			if(vis[a[i]+1]) continue;
			ans++;
			
		}
		printf("%d\n",ans);
	}
	return 0;
}
